package com.project.controller;

import com.project.pojo.Manager;
import com.project.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class MapperController {
    @Autowired
    @Qualifier("ManagerServiceImpl")
    private ManagerService managerService;



    @RequestMapping("/loginUser")
    public String  login(Manager manager, HttpServletRequest request){
        System.out.println(manager.getManagerPwd());
        List<Manager>  manager1 = managerService.queryManager(manager);

        System.out.println(manager1);
        if(manager1.size() == 0){
            request.setAttribute("error", "用户名或密码不正确,请确认后重新输入");
            return "login";
       }else{
            return "redirect:user/allUser";
        }
    }
}
